﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sealight.Core.Domain
{
  public  class OrderProductVariantEntity:BaseEntity
    {
        /// <summary>
        /// Gets or sets the order product variant identifier
        /// </summary>
        public virtual Guid OrderProductVariantID { get; set; }
        
        /// <summary>
        /// Gets or sets the order identifier
        /// </summary>
        public virtual OrderEntity Order { get; set; }

        /// <summary>
        /// Gets or sets the product variant identifier
        /// </summary>
        public virtual ProductVariantEntity ProductVariant { get; set; }

        /// <summary>
        /// Gets or sets the unit price in primary store currency (incl tax)
        /// </summary>
        public virtual decimal Price { get; set; }

        /// <summary>
        /// Gets or sets the attribute description
        /// </summary>
        public virtual string AttributeDescription { get; set; }

        /// <summary>
        /// Gets or sets the product variant attributes in XML format
        /// </summary>
        public virtual string Attributes { get; set; }

        /// <summary>
        /// Gets or sets the quantity
        /// </summary>
        public virtual int Quantity { get; set; }

        /// <summary>
        /// Gets or sets the discount amount (incl tax)
        /// </summary>
        public virtual decimal DiscountAmount { get; set; }

        public virtual Sealight.Core.DataAdapter.order_product_variant ToDataAdapter()
        {
            return new DataAdapter.order_product_variant {id=this.OrderProductVariantID, attribute_description=this.AttributeDescription, attributes=this.Attributes,
            discount_amount=this.DiscountAmount, price=this.Price, product_variant = this.ProductVariant!= null? this.ProductVariant.ToDataAdapter():null, quantity=this.Quantity, order_id = this.Order!=null?this.Order.OrderID:Guid.Empty};
        }

    }
}
